package com.hkbigdata.springbootdemo.service.impl;

import com.hkbigdata.springbootdemo.bean.Employee;
import com.hkbigdata.springbootdemo.mapper.EmployeeMapper;
import com.hkbigdata.springbootdemo.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author liuanbo
 * @creat 2024-11-06-0:41
 * @see 2194550857@qq.com
 */
@Service
public class EmployeeServiceImpl implements EmployeeService {
    @Autowired
    private EmployeeMapper employeeMapper;

    @Override
    public List<Employee> getAll() {
        System.out.println("开始处理业务逻辑");
        List<Employee> employeeList = employeeMapper.getAll();
        System.out.println("结束处理业务逻辑");
        return employeeList;
    }

    @Override
    public Employee getempByid(Integer id) {
        System.out.println("开始处理业务逻辑");
        Employee mapperOne = employeeMapper.getOne(id);
        System.out.println("结束处理业务逻辑");
        return mapperOne;

    }

    @Override
    public void addEmp(Employee employee) {
        System.out.println("开始处理业务逻辑");
        employeeMapper.add(employee);
        System.out.println("结束处理业务逻辑");
    }

    @Override
    public void updateEmp(Employee employee) {
        employeeMapper.update(employee);
    }

    @Override
    public void deleteEmp(Integer id) {
        employeeMapper.delete(id);
    }
}
